<?php

namespace App\Admin\Actions\Grid;

use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;
use Dcat\Admin\Widgets\Tab;

class MemberFollowAndFans extends RowAction
{
    /**
     * @return string
     */
    protected $title = '关注/粉丝';

    public function render()
    {
        $tab = Tab::make();
        $tab->add('关注', \App\Admin\Renderable\MemberFollowTable::make(['member_id' => $this->getKey()]), true);
        $tab->add('粉丝', \App\Admin\Renderable\MemberFansTable::make(['member_id' => $this->getKey()]));

        return Modal::make()
            ->xl()
            ->title($this->title)
            ->body($tab)
            ->button(<<<HTML
<a href="javascript:void(0)" style="margin-right: 5px;">$this->title</a>
HTML
            );
    }
}
